-
Notifications
You must be signed in to change notification settings - Fork 3
Log rotation max size #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Introduced MAX_LOGS_SIZE environment variable to set the maximum allowed log size. - Implemented log size checking and cleanup logic in the container database. - Added utility function to parse human-readable size formats. - Updated README to document the new MAX_LOGS_SIZE configuration option.
- Changed CheckBox alignment from end to start for better layout consistency. - Adjusted CheckBox roll transformation for improved visual feedback. - Modified DropDown text margin for better spacing.
README.md
Outdated
| | AGENT | Toggles agent mode. If enabled, there will be no web interface available, and all logs will be sent and stored on HOST | `false` | - | ||
| | HOST | Url to OnLogs host from protocol to domain name. | | if `AGENT=true` | ||
| | ONLOGS_TOKEN | Token that will use an agent to authorize and connect to HOST | Generates with OnLogs interface | if `AGENT=true` | ||
| | MAX_LOGS_SIZE | Maximum allowed total logs size before cleanup triggers. Accepts human-readable formats like 5GB, 500MB, 1.5GB etc. When exceeded, 30% of logs (by count) will be removed proportionally across containers starting from oldest | 5GB | - |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NoOne7135 can we decrease to 10%?
| return "other" | ||
| } | ||
|
|
||
| func checkAndManageLogSize(host string, container string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can't see ussage of host and container function params
| func ParseHumanReadableSize(sizeStr string) (int64, error) { | ||
| sizeStr = strings.TrimSpace(strings.ToUpper(sizeStr)) | ||
| for _, unit := range units { | ||
| if strings.HasSuffix(sizeStr, unit.Suffix) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets support 1g 1m etc also
if strings.HasSuffix(sizeStr, unit.Suffix) || strings.HasSuffix(sizeStr, strings.TrimSuffix(unit.Suffix, "B")) {
- Updated Docker build command to use --load for improved image handling. - Changed output binary name from 'main' to 'onlogs' in the Dockerfile. - Simplified log status key determination by removing redundant checks. - Enhanced log size management logic to ensure efficient cleanup of old logs.
No description provided.